import { Document } from 'mongoose';

export interface IMessage extends Document {
  messageId: string;
  sessionId?: string; // 关联TaskSession
  userId: string;
  role: 'user' | 'assistant' | 'system' | 'tool';
  content: string;
  messageType: string;
  parentMessageId?: string; // 支持消息回复链
  threadId?: string; // 支持消息分组
  tokens?: {
    input: number;
    output: number;
    total: number;
  };
  processingTime?: number; // 毫秒
  status: 'processed' | 'failed' | 'queued' | 'pending';
  metadata?: Record<string, any>;
  createdAt: Date;
  editedAt?: Date;
  deletedAt?: Date; // 软删除
}
